#ifndef															__TCPSOCKET_H__
#define															__TCPSOCKET_H__

#include														<boost/asio.hpp>
#include														<boost/enable_shared_from_this.hpp>
#include														"ASocket.h"


class															TcpSocket : public boost::enable_shared_from_this<TcpSocket>, public ASocket
{
public:
	typedef boost::shared_ptr<TcpSocket>						SocketPtr;
	TcpSocket(boost::asio::io_service &, unsigned int);
	virtual ~TcpSocket();
	static SocketPtr											create(boost::asio::io_service&, unsigned int);

private:
	boost::asio::ip::tcp::socket								_socket;

private:
	virtual void												_startRead();

public:
	void														_receive_size(const boost::system::error_code &, size_t);
	void														_receive_data(const boost::system::error_code &, size_t);
	virtual void												start();
	virtual	void												close();
	boost::asio::ip::tcp::socket								&getSocket();
	void														write(byte*, size_t);
	virtual std::string											getIp() const;


};

#endif // ! __TCPSOCKET_H__
